package com.bwie.domain;

import com.bwie.common.domain.User;
import com.bwie.common.domaintoo.response.CouponResponse;
import com.bwie.common.result.Result;
import com.bwie.mapper.CouponMapper;
import com.bwie.remote.UserRemote;
import com.bwie.service.CouponService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className: DateTime
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 * @date: 2025/10/3 23:07
 */
@Component
public class DateTime {

    @Autowired
    CouponMapper couponMapper;
    @Autowired
    UserRemote userRemote;

    @Scheduled(cron ="0 0 0 ? * 6,0")
    public void time(){
        //查询所有用户
        Result<List<User>>listResult=userRemote.getUser();
        List<User> userList = listResult.getData();
        //给用户添加优惠卷
        couponMapper.timeList(userList);
    }
}
